<?php
// +------------------------------------------------------------------
// | Cls-Token [ USER LOGIN AUTHENTICATION TOKEN ]
// | Copyright (c) 2024 All rights reserved.
// | Based on ThinkPHP 6 | 8
// | Licensed Mulan PSL v2 ( http://license.coscl.org.cn/MulanPSL2 )
// | Author: CLS <422064377>
// | CreateDate: 2024/7/26
// +------------------------------------------------------------------

namespace chleniang\ClsToken\util;

use think\helper\Str;

class Util
{

    public static function randomString(mixed $value): string
    {
        return md5(Str::random(8) . uniqid('', true) . (string)$value);
    }

    public static function hashUA(string $userAgent): string
    {
        return md5(substr($userAgent, 0, 1000));
    }

}